package com.lelefly.base.proxy;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import com.lelefly.base.model.UploadInfoBean;
import com.lelefly.base.po.LeleflyHistoryInfo;
import com.lelefly.base.po.LeleflyInfo1;
import com.lelefly.base.po.LeleflyInfo10;
import com.lelefly.base.po.LeleflyInfo11;
import com.lelefly.base.po.LeleflyInfo12;
import com.lelefly.base.po.LeleflyInfo2;
import com.lelefly.base.po.LeleflyInfo3;
import com.lelefly.base.po.LeleflyInfo4;
import com.lelefly.base.po.LeleflyInfo5;
import com.lelefly.base.po.LeleflyInfo6;
import com.lelefly.base.po.LeleflyInfo7;
import com.lelefly.base.po.LeleflyInfo8;
import com.lelefly.base.po.LeleflyInfo9;
import com.lelefly.base.utils.DateUtils;

public class LeleFlyInfoProxy {

	private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	public static List getLeleFlyInfo(int month,List<UploadInfoBean> infoList){
		List list = new ArrayList<>();
		
		if (month == 1) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo1 info1 = new LeleflyInfo1();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}else if (month == 2) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo2 info1 = new LeleflyInfo2();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}else if (month == 3) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo3 info1 = new LeleflyInfo3();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}else if (month == 4) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo4 info1 = new LeleflyInfo4();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}else if (month == 5) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo5 info1 = new LeleflyInfo5();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}else if (month == 6) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo6 info1 = new LeleflyInfo6();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}else if (month == 7) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo7 info1 = new LeleflyInfo7();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}else if (month == 8) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo8 info1 = new LeleflyInfo8();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}else if (month == 9) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo9 info1 = new LeleflyInfo9();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}else if (month == 10) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo10 info1 = new LeleflyInfo10();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}else if (month == 11) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo11 info1 = new LeleflyInfo11();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}else if (month == 12) {
			for (UploadInfoBean infoBean : infoList){
				LeleflyInfo12 info1 = new LeleflyInfo12();
				info1.setBarometerHeight(infoBean.getBarometerHeight());
				info1.setBattVolt(infoBean.getBattVolt());
				info1.setFlightime(infoBean.getFlightime());
				info1.setFlightmode(infoBean.getFlightmode());
				info1.setFlowData(infoBean.getFlowData());
				info1.setGpsNo(infoBean.getGpsNo());
				info1.setLatitude(infoBean.getLatitude());
				info1.setLongitude(infoBean.getLongitude());
				info1.setMobilePhoneNo(infoBean.getMobilePhoneNo());
				info1.setPlaneid(infoBean.getPlaneid());
				info1.setRadarHeight(infoBean.getRadarHeight());
				info1.setRadio(infoBean.getRadio());
				info1.setSpeed(infoBean.getSpeed());
				info1.setUserPhoneNo(infoBean.getUserPhoneNo());
				info1.setHistoryId(infoBean.getHistoryId());
				list.add(info1);
			}
		}
		return list;
	}
	
	
	public static LeleflyHistoryInfo getHistoryInfo(List<UploadInfoBean> infoBeanList){
		LeleflyHistoryInfo historyInfo = new LeleflyHistoryInfo();
		UploadInfoBean infoBean = infoBeanList.get(infoBeanList.size()-1);
		historyInfo.setFlyArea(infoBean.getFlyArea());
		try {
			historyInfo.setFlyEndTime(sdf.parse(DateUtils.getCurDate()));
			historyInfo.setFlyBeginTime(sdf.parse(infoBean.getFlyBeginTime()));
		} catch (ParseException e) {
			e.printStackTrace();
		}
		historyInfo.setFlyLatitude(infoBean.getLatitude());
		historyInfo.setFlyLongitude(infoBean.getLongitude());
		historyInfo.setFlyLength(infoBean.getFlyLength());
		historyInfo.setHistoryId(infoBean.getHistoryId());
		historyInfo.setPlaneId(infoBean.getPlaneid());
		
		return historyInfo;
	}
}
